package com.example.blog_spring.config;

import com.example.blog_spring.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@Slf4j
@ResponseBody
@ControllerAdvice
public class ExceptionAdvice {
    @ExceptionHandler
    public <T> Result<T> handle(Exception e){
        log.error("发生异常：", e);
        return Result.fail("内部错误");
    }
}
